/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Services;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 *
 * @author akay
 */
public class DBcon {

    static String driver = "com.mysql.jdbc.Driver";
    static String adres = "jdbc:mysql://localhost/resto?useUnicode=true&characterEncoding=UTF-8";
    static String kullanici = "root";
    static String sifre = "";

    public  DBcon() {
        
    }

    public Connection getconnect() {
        Connection con = null;
        try {
            con = DriverManager.getConnection(adres, kullanici, sifre);
            con.setAutoCommit(true);
        } catch (Exception e) {
            System.err.println("veri tabanina baglanilamadi!");
            e.printStackTrace();
        }

        return con;
    }
    
    public void closeConnect(Connection connection) {
		try {
			connection.close();
		} catch (SQLException e) {
			System.err.println("veri tabani kapatilamadi!");
		}
	}
}